import sys, random, bisect
from collections import deque, defaultdict
from heapq import heapify, heappop, heappush
from itertools import permutations
from math import gcd, log
input = lambda :sys.stdin.readline().rstrip()
mi = lambda :map(int, input().split())
li = lambda :list(mi())
p, q = mi()
n = int(input())
a = li()
g = gcd(p, q)
p, q = p // g, q // g
u, v, id = a[n - 1], 1, n - 2
while id >= 0:
u, v = v, u
u = a[id] * v + u
id = id - 1
g = gcd(u, v)
u, v = u // g, v // g
if u == p and v == q: print('YES')
else: print('NO')
706B - Interesting drink | 1265A - Beautiful String |
214A - System of Equations | 287A - IQ Test |
1108A - Two distinct points | 1064A - Make a triangle |
1245C - Constanze's Machine | 1005A - Tanya and Stairways |
1663F - In Every Generation | 1108B - Divisors of Two Integers |
1175A - From Hero to Zero | 1141A - Game 23 |
1401B - Ternary Sequence | 598A - Tricky Sum |
519A - A and B and Chess | 725B - Food on the Plane |
154B - Colliders | 127B - Canvas Frames |
107B - Basketball Team | 245A - System Administrator |
698A - Vacations | 1216B - Shooting |
368B - Sereja and Suffixes | 1665C - Tree Infection |
1665D - GCD Guess | 29A - Spit Problem |
1097B - Petr and a Combination Lock | 92A - Chips |
1665B - Array Cloning Technique | 1665A - GCD vs LCM |